<%@page import="java.util.ArrayList"%>
<%@page import="com.jlrdb.model.DigitalRadioBroadcast"%>
<%@page import="com.jlrdb.model.DigitalRadioBroadcasts"%>
<%@page import="com.jlrdb.model.AnalogRadioBroadcast"%>
<%@page import="com.jlrdb.model.AnalogRadioBroadcasts"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="/css/report.css">
<title>View Radio Broadcasts</title>
</head>
<body>
	<%
		DigitalRadioBroadcasts digitalRadioBroadcasts = (DigitalRadioBroadcasts) request.getAttribute("digitalRadioBroadcasts");
		AnalogRadioBroadcasts analogRadioBroadcasts = (AnalogRadioBroadcasts) request.getAttribute("analogRadioBroadcasts");
		String geography = (String) request.getAttribute("geography");
		String country = (String) request.getAttribute("country");
		HttpSession session1 = request.getSession();
		String role = (String) session1.getAttribute("Role");
	%>
	<h3>
		Geographic Region: <font color="blue"><%=geography%></font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Country: <font color="blue"><%=country%></font>
	</h3>
		<%
		if (role.equalsIgnoreCase("Admin"))
		{
	%>
	<p>
		<font color="red">click on UPDATE DETAILS to update data.</font>
	</p>
		<%
		}
	%>
	<h4>&nbsp;&nbsp;&nbsp;DIGITAL RADIO DATA</h4>
	<%
		if (digitalRadioBroadcasts.getDigitalRadioBroadcasts().size() != 0)
		{
	%>
	<%
		for (DigitalRadioBroadcast radioBroadcast : digitalRadioBroadcasts.getDigitalRadioBroadcasts())
			{
	%>
	<div id="content">
		<%
			if (role.equalsIgnoreCase("Admin"))
				{
		%>
		<p align="center">
			<a href="/RadioBroadcastServlet?action=getThisBroadcastDigital&&broadcastId=<%=radioBroadcast.getBroadcast_Id()%>">UPDATE DETAILS</a>
		</p>
			<%
			}
		%>
		<br>
		<table style="float: left; position: relative; margin-right: auto; width: 45%;">
			<tr>
				<th>Analog Radio:</th>
				<td><%=radioBroadcast.getAnalog_radio()%></td>
			</tr>
			<tr>
				<th>Digitization Status:</th>
				<td><%=radioBroadcast.getDigitization_Status()%></td>
			</tr>
			<tr>
				<th>Digital Radio Family:</th>
				<td><%=radioBroadcast.getDigital_Radio_Family()%></td>
			</tr>
			<tr>
				<th>Standard:</th>
				<td><%=radioBroadcast.getStandard()%></td>
			</tr>
			<tr>
				<th>Transmission Status:</th>
				<td><%=radioBroadcast.getTransmission_Status()%></td>
			</tr>
			<tr>
				<th>Coverage:</th>
				<td><%=radioBroadcast.getCoverage()%></td>
			</tr>
			<tr>
				<th>Start Date:</th>
				<td><%=radioBroadcast.getStart_Date()%></td>
			</tr>
			<tr>
				<th>Stop date:</th>
				<td><%=radioBroadcast.getStop_date()%></td>
			</tr>
			<tr>
				<th>Notes:</th>
				<td><%=radioBroadcast.getNotes()%></td>
			</tr>
		</table>
		<table style="position: relative; width: 45%;">
			<tr>
				<th>Frequency Spectrum:</th>
				<td><%=radioBroadcast.getFrequency_Spectrum()%></td>
			</tr>
			<tr>
				<th>Major Players:</th>
				<td><%=radioBroadcast.getMajor_Players()%></td>
			</tr>
			<tr>
				<th>Digital Radio Overall coverage:</th>
				<td><%=radioBroadcast.getDigital_Radio_Overall_coverage()%></td>
			</tr>
			<tr>
				<th>MultiPlex:</th>
				<td><%=radioBroadcast.getMultiPlex()%></td>
			</tr>
			<tr>
				<th>ASO Start Date:</th>
				<td><%=radioBroadcast.getASO_Start_Date()%></td>
			</tr>
			<tr>
				<th>ASO End Date:</th>
				<td><%=radioBroadcast.getASO_End_Date()%></td>
			</tr>
			<tr>
				<th>Regulatory authority:</th>
				<td><%=radioBroadcast.getRegulatory_authority()%></td>
			</tr>
			<tr>
				<th>Source:</th>
				<td>
					<%
						String full = radioBroadcast.getSource();
							String parts[] = full.split("[\\r\\n]+");
							for (String s : parts)
							{
								if (s.contains("http"))
								{
					%>
					<p>
						<a href="<%=s%>" target="_blank"><%=s%></a>
					</p> 
					<%} else
						{
						%>
					<p><%=s%></p>
					 <%	}
								}
							 %>
				</td>
			</tr>
			<tr>
				<th>Last Update Date:</th>
				<td><%=radioBroadcast.getLast_Update_Date()%></td>
			</tr>
		</table>
	</div>
	<br>
	<%
		}
		} else
		{
	%>
	<p>
		No Digital Radio data Available for
		<%=country%></p>
	<%
		}
	%>
	<h4>&nbsp;&nbsp;&nbsp;ANALOG RADIO DATA</h4>
	<%
		if (analogRadioBroadcasts.getAnalogRadioBroadcasts().size() != 0)
		{
	%>
	<%
		for (AnalogRadioBroadcast radioBroadcast : analogRadioBroadcasts.getAnalogRadioBroadcasts())
			{
	%>
	<div id="content">
		<p align="center">
			<a href="/RadioBroadcastServlet?action=getThisBroadcastAnalog&&broadcastId=<%=radioBroadcast.getBroadcast_Id()%>">UPDATE DETAILS</a>
		</p>
		<br>
		<table style="width: 90%;">
			<tr>
				<th>AM:</th>
				<td><%=radioBroadcast.getAm()%></td>
			</tr>
			<tr>
				<th>FM:</th>
				<td><%=radioBroadcast.getFm()%></td>
			</tr>
			<tr>
				<th>Major Players:</th>
				<td><%=radioBroadcast.getMajor_Players()%></td>
			</tr>
			<tr>
				<th>Notes/Remarks:</th>
				<td><%=radioBroadcast.getNotes_Remarks()%></td>
			</tr>
			<tr>
				<th>Last Update Date:</th>
				<td><%=radioBroadcast.getLast_Date_Updated()%></td>
			</tr>
		</table>
	</div>
	<br>
	<%
		}
		} else
		{
	%>
	<p>
		No Digital Radio data Available for
		<%=country%></p>
	<%
		}
	%>
</body>
</html>